package Item
{
	public class CItem_Virus extends CItem
	{
		private const TIME_TO_ENABLE	:Number = 2;
		
		public static const STATE_READY	:uint = 0;
		public static const STATE_ENABLE	:uint = 1;
		
		private var m_state :uint = STATE_READY;
		private var m_nTimeToEnable :Number = 0;
		
		public function get state() :uint { return m_state; }
		
		public function CItem_Virus()
		{
			super(TYPE_VIRUS);
			m_sprite = new CSprite_ItemVirus();
			m_sprite.alpha = 0.3;
		}
		override public function Update(tick :Number) :void
		{
			m_nTimeToEnable += tick;
			
			if (m_nTimeToEnable > TIME_TO_ENABLE)
			{
				m_state = STATE_ENABLE;
				m_sprite.alpha = 1;
			}
			
			m_nDestroyElapsedTime += tick;
			
			if (m_nDestroyElapsedTime > CItem.TIME_DESTROY_VIRUS - 1.0)
			{
				m_sprite.alpha = (CItem.TIME_DESTROY_VIRUS-m_nDestroyElapsedTime)/1;
			}
			
			if (m_nDestroyElapsedTime > CItem.TIME_DESTROY_VIRUS)
			{
				m_bIsDestroy = true;
			}
		}
		
	}
}